import { request } from "@/service/request";

/**
 * 封装的公共请求函数和自定义toast
 * @param params 请求参数
 */
export async function requestToast(
  params: any,
  api: string,
  toast: string
): Promise<{ data: any; status: boolean }> {
  try {
    const response = await request.post<any>(api, params);
    
    // 处理成功响应
    showToast(toast)
    return {
      data: response.data,
      status: true,
    };
  } catch (error: any) {
    return {
      data: null,
      status: false,
    };
  }
}
